class Solution {
public:

    bool IsPopOrder(vector<int>& pushV, vector<int>& popV) {
        // write code here
        stack<int> _st;
        int popi = 0;
        for (auto e : pushV)
        {

            _st.push(e);
            while (!(_st.empty()) && _st.top() == popV[popi])
            {
                _st.pop();
                popi++;
            }
        }
        return _st.empty();
    }
};